# @Version        : 1.0
# @Update Time    : 2024/9/23 21:09
# @File           : login_record_schema.py
# @IDE            : PyCharm
# @Desc           : 文件描述信息
from typing import Literal, Optional
from pydantic import Field
from src.schemas.base_schema import MixinSchema
from src.core.base import BaseSchema
from src.common.typing.schema_typing import DictStr


class LoginRecordCreate(BaseSchema):
    username: str = Field(..., description="用户名")
    ipaddr: str | None = Field(None, description="登录地址")
    # 地理位置
    continent: str | None = Field(None, description="大洲")
    country: str | None = Field(None, description="国家")
    province: str | None = Field(None, description="省份")
    city: str | None = Field(None, description="城市")
    district: str | None = Field(None, description="区县")
    isp: str | None = Field(None, description="运营商")
    area_code: str | None = Field(None, description="区号")
    city_code: str | None = Field(None, description="城市代码")
    longitude: str | None = Field(None, description="经度")
    latitude: str | None = Field(None, description="纬度")
    # 浏览器
    browser: str | None = Field(None, description="浏览器")
    os: str | None = Field(None, description="操作系统")
    agent: DictStr | None = Field(None, description="代理")
    status: Optional[str] = Field(None, description="状态")
    message: str | None = Field(None, description="错误信息")
    params: DictStr | None = Field(None, description="参数")
    login_type: str | None = Field(None, description="登录类型")


class LoginRecordOut(MixinSchema, LoginRecordCreate):
    pass
